package one_class_design.three_work;

/**
 * @author 北巷_东坡
 * @date 2022/9/16 20:40
 * @computer 10741
 */
public class three_run {
    public static void main(String[] args) {
        //第一辆卡车
        ComputerWeight[] frist_goods = new ComputerWeight[3];
        Truck frist_car = new Truck(frist_goods);
        double tele_num,wash_num,comp_num,frist_total_num=650;
        tele_num=wash_num=comp_num=0;//初始化每种货物数量
//        frist_car.totalWeights=650;
//        System.out.println((int)frist_car.totalWeights);
        for (int i = 0; i <(int)frist_total_num ; i++) {
            if(i/3==0){
                tele_num+=1;
            }else if(i%3==1){
                comp_num+=1;
            }else{
                wash_num+=1;
            }
        }
        frist_goods[0] = new Television(150,tele_num);
        frist_goods[1] = new Computer(100,comp_num);
        frist_goods[2] = new WashMachine(250,wash_num);
        for (int i = 0; i < frist_goods.length; i++) {
            frist_car.totalWeights=frist_goods[i].computeWeight();
        }
        System.out.println("第一辆货车装载的货物重量："+frist_car.totalWeights+"kg");

        //第二辆卡车
        ComputerWeight[] second_goods = new ComputerWeight[2];
        Truck second_car = new Truck(second_goods);
        double tele_2_num,wash_2_num,second_total_num=68;
        tele_2_num=wash_2_num=0;
        for (int i = 0; i < second_total_num; i++) {
            if(i/2==0){
                tele_2_num+=1;
            }else {
                wash_2_num+=1;
            }
        }
        second_goods[0]=new Television(150,tele_2_num);
        second_goods[1]=new WashMachine(250,wash_2_num);
        for (int i = 0; i < second_goods.length; i++) {
            second_car.totalWeights=second_goods[i].computeWeight();
        }
        System.out.println("第二辆货车装载的货物重量："+second_car.totalWeights+"kg");
    }
}
